package com.example.controller;

import com.example.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/user",produces = {"text/plain;charset=utf-8","text/html;charset=utf-8"})
@ResponseBody
public class UserController {
    @GetMapping("/")
    public String index() {
        return "user";
    }

    @GetMapping("/t1")
    public String test1(@RequestParam("name") String name) {
        System.out.println(name);
        return "name 参数值：" + name;
    }

    @GetMapping("/t2")
    public String test2(User user) {
        System.out.println(user);
        return user.toString();
    }
}
